{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "54b06c89",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "from sklearn.metrics import accuracy_score, roc_auc_score, mean_squared_error, mean_absolute_percentage_error\n",
    "\n",
    "log_file = r'C:\\Users\\onekey\\Desktop\\data\\code\\models\\resnet50\\train/Epoch-6.txt'\n",
    "log = pd.read_csv(log_file, names=['ID', 'Prediction', 'Ground Truth'], sep='\\t')\n",
    "display(log)\n",
    "mse = mean_squared_error(log['Ground Truth'], log['Prediction']),\n",
    "mape = mean_absolute_percentage_error(log['Ground Truth'], log['Prediction'])\n",
    "\n",
    "print(f\"MSE:{mse}, MAPE:{mape}\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "63800e06",
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "import numpy as np\n",
    "import seaborn as sns\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "os.makedirs('img', exist_ok=True)\n",
    "sns.set_palette([\"black\", \"gray\", \"white\"])\n",
    "\n",
    "sns.jointplot(y='Ground Truth', x=f'Prediction', data=log,  kind=\"reg\", truncate=False, height=10)\n",
    "plt.savefig(f'img/Regression.svg', bbox_inches='tight')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d859a52e",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
